package com.svw.asmpcloud.bean;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.SpringSecurityCoreVersion;
/**
 * copy SimpleGrantedAuthority 自定义 UriSimpleGrantedAuthority
 * @author yaoayao
 *
 */
public class UriSimpleGrantedAuthority implements GrantedAuthority{
    private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
    private String role;

    public UriSimpleGrantedAuthority() {
    }
    public UriSimpleGrantedAuthority(String role) {
        this.role = role;
    }

    @Override
    public String getAuthority() {
        return role;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj instanceof UriSimpleGrantedAuthority) {
            return role.equals(((UriSimpleGrantedAuthority) obj).role);
        }
        return false;
    }

    @Override
    public int hashCode() {
        return this.role.hashCode();
    }

    @Override
    public String toString() {
        return this.role;
    }
    
    public void setAuthority(String role) {
        this.role=role;
    }
}
